from django.conf.urls import url
from django.contrib import admin
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.routers import DefaultRouter

from .views import statistical,users,specs,images,skus,spus,orders,permission,groups,admin,brands,channels,options

urlpatterns = [
    # 使用JWt完成登录业务
    url(r'^authorizations/$', obtain_jwt_token),
    # url(r'^authorizations/$', ObtainJSONWebToken.as_view()),
    # 数据统计
    url(r'^statistical/total_count/$', statistical.UserCountView.as_view()),
    url(r'^statistical/day_increment/$', statistical.UserAddView.as_view()),
    url(r'^statistical/day_active/$', statistical.UserDayActiveView.as_view()),
    url(r'^statistical/day_orders/$', statistical.UserOrderView.as_view()),
    url(r'^statistical/month_increment/$', statistical.UserMonthView.as_view()),
    url(r'^statistical/goods_day_views/$', statistical.GoodsTypeView.as_view()),
#用户表管理
    url(r'^users/$', users.UserView.as_view()),
# 商品管理
    url(r'^goods/simple/$', specs.SpecsView.as_view({'get':'simple'})),
    url(r'^skus/simple/$', images.ImageView.as_view({'get':'simple'})),
    url(r'^goods/(?P<pk>\d+)/specs/$', skus.SKUView.as_view({'get': 'specs'})),
    url(r'^permission/content_types/$', permission.PermissionView.as_view({'get': 'content_types'})),
    # 获取权限简单信息
    url(r'^permission/simple/$', groups.GroupsView.as_view({'get': 'simple'})),
# 获取分组简单信息
 	url(r'^permission/groups/simple/$', admin.AdminView.as_view({'get': 'simple'})),

# spu
    url(r'^goods/brands/simple/$', spus.SPUView.as_view({'get': 'brand'})),
    url(r'^goods/channel/categories/(?P<pk>\d+)/$', spus.SPUView.as_view({'get': 'simple'})),
    url(r'^goods/channel/categories/$', spus.SPUView.as_view({'get': 'categories'})),
# brand
    url(r'^goods/simple/$', brands.BrandsView.as_view({'get': 'simple'})),
# channel频道
    url(r'^goods/channel_types/$', channels.ChannelsView.as_view({'get': 'channel_types'})),
    url(r'^goods/categories/$', channels.ChannelsView.as_view({'get': 'categories'})),
# option
    url(r'^goods/specs/simple/$', options.OptionsView .as_view({'get': 'simple'})),
]
# brand品牌
router = DefaultRouter()
router.register('goods/brands',brands.BrandsView , base_name='goods')
urlpatterns +=router.urls
# channel
router = DefaultRouter()
router.register('goods/channels',channels.ChannelsView , base_name='channels')
urlpatterns +=router.urls
# options规格管里
router = DefaultRouter()
router.register('specs/options',options.OptionsView , base_name='options')
urlpatterns +=router.urls
#
#商品规格
router = DefaultRouter()
router.register('goods/specs',specs.SpecsView,base_name='specs')
urlpatterns +=router.urls

# 图片表
router = DefaultRouter()
router.register('skus/images',images.ImageView,base_name='imanges')
urlpatterns +=router.urls

# sku
router = DefaultRouter()
router.register('skus',skus.SKUView , base_name='skus')
urlpatterns +=router.urls

# SPU
router = DefaultRouter()
router.register('goods',spus.SPUView , base_name='goods')
urlpatterns +=router.urls



# 订单管理
router = DefaultRouter()
router.register('orders',orders.OrdersView , base_name='orders')
urlpatterns +=router.urls

#权限
router = DefaultRouter()
router.register('permission/perms',permission.PermissionView , base_name='perms')
urlpatterns +=router.urls

# 用户组管理
router = DefaultRouter()
router.register('permission/groups',groups.GroupsView , base_name='groups')
urlpatterns +=router.urls

# 管理员
router = DefaultRouter()
router.register('permission/admins',admin.AdminView , base_name='admins')
urlpatterns +=router.urls
